# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Project Name: luffcity study project
File Name: admin_interface.py
有来链接view层的界面显示 和 modles层中的数据处理
Author: kij
Create Date: 2021/2/22
-------------------------------------------------
"""
import hashlib

from modle.modles import Admin, School, Teacher, Lesson, Student


def register_interface(user_name, user_password):
	admin = Admin(user_name, user_password)
	admin.save_data()
	return True, '注册成功'


# 创建学校，学校名称地址和关联的管理员id
def create_school_interface(school_name, school_address, user_name):
	school = School(school_name, school_address, user_name)
	school.save_data()
	return True, "创建成功"


# 创建老师 默认密码123
def create_teacher_interface(teacher_name, user):

	m = hashlib.md5('123'.encode('utf-8'))
	m.update('123'.encode('utf-8'))

	teacher = Teacher(teacher_name, m.hexdigest(), user)
	teacher.save_data()
	return True, "保存成功"


# 创建课程
def create_lesson_interface(lesson_name, lesson_time, lesson_price, school_name):
	obj = Lesson(lesson_name, lesson_time, lesson_price, school_name)
	obj.save_data()
	return True, "保存成功"

